<!DOCTYPE html>
<html>
<!--Made By kailuosoft.com, TEL 171 9992 9517 -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>凯络科技后台管理系统 - 订单明细</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

     <link rel="shortcut icon" href="favicon.ico"> <link href="__PUBLIC__/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/css/style.min862f.css?v=4.1.0" rel="stylesheet">
	<link href="__PUBLIC__/css/page.css" rel="stylesheet">
    <link href="__PUBLIC__/css/new.css" rel="stylesheet">
	<script src="__PUBLIC__/js/jquery.min63b9.js?v=2.1.4"></script>
    <script src="__PUBLIC__/js/plugins/layer/layer.min.js"></script>
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                           <h5>采购明细</h5>
                    </div>
                    
                    <div class="ibox-content">
                    <form action="" method="post">
                    <div style="margin-left:15px;">
                    	<input type="button" value="一键填满" class="btn btn-sm btn-primary add" id="full_in"></input>
                        <input type="hidden" value="{$porder_number}" class="btn btn-sm btn-primary add" id="porder_number"></input>
                    </div>
                    
                    
                            <div class="col-sm-10"> 
                            	<div style=" height:100%; overflow:auto; margin-bottom:20px;">
                                <table class="table table-bordered table-striped table-hover" style="width:100%">
                                    <thead >
                                        <tr>
                                        	<th class="sort-column name">采购员</th>
                                        	<th class="sort-column name">供应商</th>
                                            <th class="sort-column name">SKU</th>
                                            <th class="sort-column name">产品图片</th>
                                            <th class="sort-column name">采购单价</th>
                                            <th class="sort-column name">总数量</th>
                                            <th class="sort-column name">业务员</th>
                                            <th class="sort-column name">订单号</th>
                                            <th class="sort-column name">产品数量</th>
                                            <th class="sort-column name">历史订单</th>
                                            <th class="sort-column name">采购数量</th>
                                            <th class="sort-column name">备注</th>
                                        </tr>
                                    </thead>
                                    <tbody id='tab'>
                                    <foreach name="order_list" item="order" key="k">
                                        <tr>	
                                        	<td class="buyer">
                                            	
                                                {$order.buyer}
                                            </td>
                                        	<td>{$order.supplier}</td>
                                            <td>{$order.sku}</td>
                                            <td width="150px" height="150px" ><img src="{$order.main_pic}" width="100%" height="100%" alt="图片不存在或已丢失" /></td>
                                            <td>{$order.cost_price}</td>
                                            <td nameval='quantity' id = "quantity_{$k}">{$order.count}</td>
                                            <td>{$order.salesman}</td>
                                            <td>{$order.order_number}</td>
                                            <td class='quantity_{$k}'>{$order.quantity}</td>
                                            <td><if condition="$create_time[$k]['create_time'] neq $now_time">**该产品为历史订单</if></td>
                                            <td><input type='text' class='input-sm form-control' name='quantity[]' id="tity_{$k}" value="<if condition="$order.purchase_quantity neq null">{$order.purchase_quantity}</if>"></td>
                                            <td>
                                            	<input type='hidden' class='input-sm form-control' name='order_ids[]' value="{$order.id}">
                                                <input type='text' class='input-sm form-control' name='remarks[]' value="{$order.remarks}">
                                            </td>
                                       </tr>
                                  </foreach>
                                  

  
                                       		<td colspan="12	">
                                            	<input type="submit" class="btn btn-lg btn-primary sku" value="保存" name="edit"></input>
                                                
                                            </td>
                                       </tr>
                                       
                                </table>
                                </div>  
                        	</div>
                            
                       </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="__PUBLIC__/js/jquery.min63b9.js?v=2.1.4"></script>
	<script src="__PUBLIC__/js/bootstrap.min14ed.js?v=3.3.6"></script>
    <script src="__PUBLIC__/js/plugins/peity/jquery.peity.min.js"></script>
    <script src="__PUBLIC__/js/content.mine209.js?v=1.0.0"></script>
    <script src="__PUBLIC__/js/plugins/iCheck/icheck.min.js"></script>
    <script src="__PUBLIC__/js/demo/peity-demo.min.js"></script>
    
    <script src="__PUBLIC__/js/plugins/layer/laydate/laydate.js"></script>
    <script src="__PUBLIC__/js/plugins/jquery.tablesort.min.js"></script>
   


</body>
<!--Made By kailuosoft.com, TEL 171 9992 9517 -->
<script  type="text/javascript"  src="http://g.tbcdn.cn/sj/securesdk/0.0.3/securesdk_v2.js"  id="J_secure_sdk_v2" data-appkey="23416550"></script>
<script>
	$('#full_in').click(function(){
		var count = "{$k}";
		for(var i=0;i<=count;i++){
			var a = $(".quantity_"+i).text();
			var b = $('#tity_'+i).val(a);;
		}
	})

</script>
<script>
$(document).ready(function() {
	$(function(){
		 function merge2() {     //可实现合并单元格,上下行来比较 
			var totalCols = $("#tab").find("tr:eq(0)").find("td").length; 
			var totalRows = $("#tab").find("tr").length; 
			if(totalRows > 1){
				for ( var i = totalCols-1; i >= 0; i--) { 
					if(i >= 3)continue;
					var sum =0;
					for ( var j = totalRows-1; j >= 0; j--) { 
						startCell = $("#tab").find("tr").eq(j).find("td").eq(i); 
						targetCell = $("#tab").find("tr").eq(j - 1).find("td").eq(i);	
					if (startCell.text() == targetCell.text() && targetCell.text() != "") { 
						
						if(i == 2){
							var two = 	$("#tab").find("tr").eq(j).find("td").eq(3); 
							var two_1 = $("#tab").find("tr").eq(j - 1).find("td").eq(3); 
							var there = $("#tab").find("tr").eq(j).find("td").eq(4); 
							var there_1 = $("#tab").find("tr").eq(j - 1).find("td").eq(4);
							
							var five = $("#tab").find("tr").eq(j).find("td").eq(5);
							var five_1 = $("#tab").find("tr").eq(j-1).find("td").eq(5); 
						/*	if(sum  == 0){
								sum = parseInt(five_1.html()) + parseInt(five.html());
							}else{
								sum += 	parseInt(five_1.html());
							}
							console.log(five_1.html());*/
							//var sum = parseInt(five.html());
							//var five_1 = $("#tab").find("tr").eq(j - 1).find("td").eq(5);
							two_1.attr("rowSpan", (two.attr("rowSpan")==undefined)?2:(eval(two.attr("rowSpan"))+1));
							there_1.attr("rowSpan", (there.attr("rowSpan")==undefined)?2:(eval(there.attr("rowSpan"))+1));
							five_1.attr("rowSpan", (five.attr("rowSpan")==undefined)?2:(eval(five.attr("rowSpan"))+1));
							
							
							five.remove();
							two.remove();
							there.remove();
						}
						targetCell.attr("rowSpan", (startCell.attr("rowSpan")==undefined)?2:(eval(startCell.attr("rowSpan"))+1)); 
						startCell.remove(); 
					} 
				} 
				} 
			 } 
		 }
		 merge2();
	 })
 })

	/*$(document).ready(function() {
	
	
	var sum = "{$sum}";
	for(var i = 0;i<sum;i++){
	var str = '';
	var one = 1;
	var now = -1;
	$(".tb_"+i+" .buyer").each(function(e){
		if($(this).html() == str){
			if(now == -1){
				now = e;
			}
			one++;
			str = $(this).html();
		}else{
			str = $(this).html();
		}
			
	});
	if(one > 1){
		$(".tb_"+i+" .buyer").eq(now-1).attr("rowspan",one);
		$(".tb_"+i+" .buyer").each(function(e){
			if(e > now-1){
				$(this).remove(); 
			}
		})
		one = 1;
		now =  -1;
	}
	
	
	
	$(".tb_"+i+" .supplier").each(function(e){
		if($(this).html() == str){
			if(now == -1){
				now = e;
			}
			one++;
			str = $(this).html();
		}else{
			str = $(this).html();
		}
			
	});
	if(one > 1){
		$(".tb_"+i+" .supplier").eq(now-1).attr("rowspan",one);
		$(".tb_"+i+" .supplier").each(function(e){
			if(e > now-1){
				$(this).remove();
			}
		})
		one = 1;
		now =  -1;
	}
	
	
	$(".tb_"+i+" .sku").each(function(e){
		if($(this).html() == str){
			if(now == -1){
				now = e;
			}
			one++;
			str = $(this).html();
		}else{
			str = $(this).html();
		}
			
	});
	if(one > 1){
		$(".tb_"+i+" .sku").eq(now-1).attr("rowspan",one);
		$(".tb_"+i+" .cost_price").eq(now-1).attr("rowspan",one);
		$(".tb_"+i+" .quantity").eq(now-1).attr("rowspan",one);
		var p_sum = 0;
		var total = 0;
		
		$(".tb_"+i+" .sku").each(function(e){
			if(e >= now -1){
				p_sum = parseFloat($(".tb_"+i+" .cost_price").eq(e).html());
				total += parseInt($(".tb_"+i+" .quantity").eq(e).html());
			}
			if(e > now-1){
				$(this).remove();
				$(".tb_"+i+" .cost_price").eq(e).remove();
				$(".tb_"+i+" .quantity").eq(e).remove();
				
			}
		})
		$(".tb_"+i+" .cost_price").eq(now-1).html(p_sum);
		$(".tb_"+i+" .quantity").eq(now-1).html(total);
		one = 1;
		now =  -1;
	}
	
	$(".tb_"+i+" .main_pic").each(function(e){
		if($(this).html() == str){
			if(now == -1){
				now = e;
			}
			one++;
			str = $(this).html();
		}else{
			str = $(this).html();
		}
			
	});
	if(one > 1){
		$(".tb_"+i+" .main_pic").eq(now-1).attr("rowspan",one);
		$(".tb_"+i+" .main_pic").each(function(e){
			
			
			$(".tb_"+i+" .sku").each(function(e){
				if($(this).html() == str){
					if(now == -1){
						now = e;
					}
					one++;
					str = $(this).html();
				}else{
					str = $(this).html();
				}
					
			});
			
			
			
			if(e > now-1){
				$(this).remove();
			}
		})
		one = 1;
		now =  -1;
	}*/
	/*
	$(".tb_"+i+" .cost_price").each(function(e){
		if($(this).html() == str){
			if(now == -1){
				now = e;
			}
			one++;
			str = $(this).html();
		}else{
			str = $(this).html();
		}
			
	});
	if(one > 1){
		$(".tb_"+i+" .cost_price").eq(now-1).attr("rowspan",one);
		$(".tb_"+i+" .cost_price").each(function(e){
			console.log(e);
			console.log(now);
			if(e > now-1){
				$(this).remove();
			}
		})
		one = 1;
		now =  -1;
	}
	/*str = '';
	
	
	
	$(".supplier").each(function(e){
		if($(this).html() == str){	
			if(now == 0){
				now = e;
			}
			one++;
			str = $(this).html();
			$(this).remove();
		}else{
			str = $(this).html();
		}
			
	});
	if(one > 1){
		$(".supplier").eq(now).attr("rowspan",one);
		one = 1;
		now = 0;
	}
	str = '';
	
	
	
	$(".sku").each(function(e){
		if($(this).html() == str){	
		
			if(now == 0){
				now = e;
			}
			one++;
			str = $(this).html();
			$(this).remove();
		}else{
			str = $(this).html();
		}
			
	});
	if(one > 1){
		var where = $('.sku').index();
		$(".sku").eq(now).attr("rowspan",one);
		one = 1;
		now = 0;
	}
	str = '';
	
	
	
	
	$(".main_pic").each(function(e){
		if($(this).html() == str){
			if(now == 0){
				now = e;
			}	
			one++;
			str = $(this).html();
			$(this).remove();
		}else{
			str = $(this).html();
		}
			
	});
	if(one > 1){
		var where = $('.main_pic').index();
		$(".main_pic").eq(now).attr("rowspan",one);
		one = 1;
		now = 0;
	}
	str = '';
	
	
	
	
	$(".cost_price").each(function(e){
		if($(this).html() == str){
			if(now == 0){
				now = e;
			}		
			one++;
			str = $(this).html();
			$(this).remove();
		}else{
			str = $(this).html();
		}
			
	});
	if(one > 1){
		$(".cost_price").eq(now).attr("rowspan",one);
		one = 1;
		now = 0;
	}
	str = '';
	
	
	
	$(".total").each(function(e){
		var couaaant = $('.sku').getAttribute('rowspan');
		if($('.sku').html() == str){	
			one++;
			str = $(this).html();
			$(this).remove();
		}else{
			str = $(this).html();
		}
			
	});
	if(one > 1){
		$(".cost_price").eq(0).attr("rowspan",one);
		one = 1;
	}
	str = '';
	
	
    $('.check-all').on('ifChecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定 
    	  $('.i-checks').iCheck('check');
    	});

    $('.check-all').on('ifUnchecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定 
    	  $('.i-checks').iCheck('uncheck');
    	});
		
     
	  $('#check').click(function(){
		    tids='';
		    $('.i-checks').each(function(){
				if($(this).prop('checked'))
				{
					tids+=$(this).val()+',';
				}
			 })
		    $(this).attr('href','shenhe?tids='+tids);
			
		  }) 
		  
	 $('#recheck').click(function(){
		    tids='';
		    $('.i-checks').each(function(){
				if($(this).prop('checked'))
				{
					tids+=$(this).val()+',';
				}
			 })
			 if(tids=='')
			 {
				 layer.alert('请选择订单');
				 return false
			 }
		    $(this).attr('href','gocheck?tids='+tids);
			
	  }) 
	  */
	/*}
    
});*/
</script>

</html>
